home *** CD-ROM | disk | FTP | other *** search
- unit Registry;
-
- {
- LEGALIES
-
- Borland Delphi TRegistry component 1.01 (version 1.0 revision 1) July 12, 1995
- (c)opyright elite!developments 1995. all rights reserved.
- written by marc hoffman <marc@arb-phys.uni-dortmund.de>
-
- requires Windows95. does NOT require Delphi 95.
-
- this package is freeware. you may use TRegistry in your applications and distribute
- these applications as you wish, without any licensing fee.
- you may distribute this package as you will, too, as long as no part of it is due
- to any changes unautorized by elite!developments.
- the exclusive (c)opyrights to this entire package belong to elite!developments.
-
- elite!developments, elite@elitedev.bluebocs.donut.ruhr.com, +49.(0)231.737627
-
-
- Borland Delphi is a registered trademak of Borland International Inc.
-
- WHAT IS TRegistry?
-
- TRegistry is ccomponent for Delphi that allows you to store infrmation needed by
- your application in the system registry of Win95 (and possibly WindowsNT), just
- as applications under Win3.1 would have used the .INI files.
-
- TRegistry is NOT a component to access the entire system registry. for such a
- component look out for future releases of elite!developments.
-
- WHY SHOULD I USE THE REGISTRY INSTEAD OF .INI FILES?
-
- there are several reasons:
-
- 1. Microsoft encourages the use of the system registry and has implemented the
- .INI functionality in Win95 only to remain compatibility with older applications
- chances are future versions of Win will not provide and .INI capabilities.
-
- 2. the registry offers several advantages over .INI files
- -nested strcuture of information. in the system registry you can have keys
- within keys within keys within... you catch de draft, whilst in .INI files you
- only have one depth of sections and keys.
- -user specific data. if the Win95 system is set to store different profiles
- for each user, you can write userdependent data into the reggistry and
- TRegistry will automatically access the data of the current user.
-
- HOW DO I IMPLEMENT TRegistry?
-
- nothing simpler than that.
- after you have installed the component in Delphis component palette, you can simply
- drop in onto a form and set it's properties.
-
- namely, you should set the ApplicationName and CompanyName properties, since TREgistry
- will create a unique key name to store all your data under. feel free to use your full
- company and application name, and not just abreviations, to assure individuality.
- this key prevents both applications from other developers and your own aplications to
- interfere in the registry.
-
- once this is done, you can call the ReadString/WriteString methods to access keys in the
- registry.
-
- ReadString reads a key from the registry, ReadStringUser reads a string from the user-specific
- part of the registry. notice that these two sections do not overlap. so you can have an
- identical key-name in both sections, but access different data, ReadString accessing the
- global data and ReadStringUser accessing the user specific data.
- if a key accessed by ReadString/ReadStringUser does not exists, TRegistry raises an
- ERegistryError exception. check the Delphi documentation for details on how to handle
- exceptions.
-
- WriteString and WriteStringUser write a ke to the gloabl and user specific part of the
- registry, respectively. if a key written to does not exist, it is created.
-
- The RootKey and RootKeyUser properties are read only properties you can use to check the
- which place in the registry your information will be stored in
-
- if any questions come up concerning TRegistry, feel free to contact me at
-
- marc@abr-phys.uni.dortmund.de (preferred)
- marc@elitedev.bluebocs.donut.ruhr.com
- marc@2:2444/1007.123@fido.net (fido)
-
- COMING SOON:
-
- TFileRegistry (registering file types, including Shell & DDE protocols)
- TRegistry 1.5 (access to Win95 specific types of registry entries (binaries, dwords)
- TRegEdit (component for full access to the registry)
-
- the latter two can be expected as soon as i get some decent Win95 developers docu.
- i mean...who the hell has enuff spare money to subscribe to MSDN? :-)
- }
-
- type
- ERegistryError = class(Exception)
- end;
-
- TRegistry = class(TComponent)
- protected
- public
- constructor Create(AOwner:TComponent); override;
- destructor Destroy; override;
- procedure WriteString(key,value:string);
- procedure WriteStringUser(key,value:string);
- function ReadString(key:string):string;
- function ReadStringUser(key:string):string;
- published
- property ApplicationName:string read write;
- property CompanyName:string read write;
- property RootKey:string read;
- property RootKeyUser:string read;
- end;
- end.
-